import os

import unittest
# 创建测试套件
import HTMLTestRunner_PY3

from scripts.test_department import TestDepartment
from scripts.test_emp_parmeter import TestEmployee_parameter
from scripts.test_login_parmeter import Test_login_parameter

suite = unittest.TestSuite()
# 将测试用例添加到测试套件当中
suite.addTest(unittest.makeSuite(TestEmployee_parameter))
suite.addTest(unittest.makeSuite(Test_login_parameter))
suite.addTest(unittest.makeSuite(TestDepartment))
# 定义生成的测试报告的路径和名称
# report_path=app.BASE_DIR+"/report/ihrmEmployee_report{}.html".format(time.strftime("%Y%m%d %H%M%S"))
report_path = os.path.dirname(os.path.abspath(__file__)) + "/report/ihrmEmployee_report.html"
# 使用HTMLTestRunner_Py3来生成测试报告
with open(report_path, mode="wb")as f:
    # 实例化HTMLTestRunner_PY  verbosity=2运行结果通过为ok   verbosity=1运行结果通过为.
    runner = HTMLTestRunner_PY3.HTMLTestRunner(f, verbosity=2, title="tpshop接口测试", description="这是用于测试tpshop登陆接口的代码")
    # 运行测试套件
    runner.run(suite)
